On Building Trees with Minimum Height, Relationally
نویسنده
چکیده
Relationally Shin-Cheng Mu Computing Laboratory, University of Oxford s m omlab.ox.a .uk Abstra t The algebrai style of reasoning about programs has been proposed and studied by omputing s ientists. We rephrase the old problem of building trees of minimum height as an optimisation problem and apply the greedy theorem to derive a linear time algorithm. To put the problem in the right form, we nd it ne essary to generalise from fun tions to relations and make use of the onverse of a fun tion theorem to write the inverse of a fun tion as a fold. 1 Introdu tion Given a list of trees. The task is to ombine them into one, retaining the leftto-right order of the trees. How an we ombine them so that the height of the resulting tree is as small as possible? The a tual ontents of the subtrees are not relevant. Therefore we an think of the input as a list of numbers representing the heights of the subtrees. Fig. 1 illustrates one of the best arrangement of subtrees with heights [2; 9; 8; 3; 6; 9℄, whose height is 11.
منابع مشابه
Building Optimal Binary Search Trees from Sorted Values in O(N) Time
First, we present a simple algorithm which, given a sorted sequence of node values, can build a binary search tree of minimum height in O(N) time. The algorithm works with sequences whose length is, a priori, unknown. Previous algorithms [1-3] required the number of elements to be known in advance. Although the produced trees are of minimum height, they are generally unbalanced. We then show ho...
متن کاملبررسی ویژگی های ریخت شناسی درختان کهنسال در جنگل های زاگرس (مطالعه موردی: جنگل های استان ایلام)
This study was conducted in oak forests of Ilam province in order to evaluate the morphological characteristics of old trees including diameter at breast height, trunk height, whole tree height, minimum and maximum crown diameter, crown health, crown vitality, crown symmetry, health and form of the trunk, Was investigated. Selection of old trees was performed based on the criteria of DBH and wi...
متن کاملBit 34 (1994), 000{000. Finding Minimum Height Elimination Trees for Interval Graphs in Polynomial Time
The elimination tree plays an important role in many aspects of sparse matrix factorization. The height of the elimination tree presents a rough, but usually eeective, measure of the time needed to perform parallel elimination. Finding orderings that produce low elimination trees is therefore important. As the problem of nding minimum height elimination tree orderings is NP-hard, it is interest...
متن کاملOn the Average Height of b-Balanced Ordered Trees
An ordered tree with height h is b-balanced if all its leaves have a level l with h − b <= l <= h, where at least one leaf has a level equal to h − b. For large n, we shall compute asymptotic equivalents to the number of all b-balanced ordered trees with n nodes and of all such trees with height h. Furthermore, assuming that all b-balanced ordered trees with n nodes are equally likely, we shall...
متن کاملمطالعه اثر متغیرهای اقلیمی (دما و بارندگی) بر پهنای دوایر سالانه کاج بروسیا Pinus brutia در استان لرستان
Trees have been affected by environmental changes, including climatic conditions. Thus, the study on anatomical and morphological characteristics of tree rings provides the possibility of climate study. The present investigation aimed to study the effect at climatic factors such as temperature (maximum, medium and minimum), precipitation on the growth rings of Pinus brutia. 30 Pinus brutia tree...
متن کامل